package com.itmumu.miniwechat.chat.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;

/**
 * 
 * @TableName group_info
 */
@TableName(value ="group_info")
@Data
public class GroupInfo implements Serializable {
    /**
     * 群组ID
     */
    @TableId
    private Integer groupId;

    /**
     * 群名称
     */
    private String groupName;

    /**
     * 群二维码，扫码可加入群聊
     */
    private String groupQrcode;

    /**
     * 群头像
     */
    private String avatar;

    /**
     * 群管路员ID
     */
    private Integer ownerUid;

    /**
     * 群公告
     */
    private String groupNotice;

    /**
     * 加入群用户数量
     */
    private Integer joinCount;

    /**
     * 状态：1=正常，0=已解散
     */
    private Integer status;

    /**
     * 创建时间
     */
    private Integer createTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        GroupInfo other = (GroupInfo) that;
        return (this.getGroupId() == null ? other.getGroupId() == null : this.getGroupId().equals(other.getGroupId()))
            && (this.getGroupName() == null ? other.getGroupName() == null : this.getGroupName().equals(other.getGroupName()))
            && (this.getGroupQrcode() == null ? other.getGroupQrcode() == null : this.getGroupQrcode().equals(other.getGroupQrcode()))
            && (this.getAvatar() == null ? other.getAvatar() == null : this.getAvatar().equals(other.getAvatar()))
            && (this.getOwnerUid() == null ? other.getOwnerUid() == null : this.getOwnerUid().equals(other.getOwnerUid()))
            && (this.getGroupNotice() == null ? other.getGroupNotice() == null : this.getGroupNotice().equals(other.getGroupNotice()))
            && (this.getJoinCount() == null ? other.getJoinCount() == null : this.getJoinCount().equals(other.getJoinCount()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getGroupId() == null) ? 0 : getGroupId().hashCode());
        result = prime * result + ((getGroupName() == null) ? 0 : getGroupName().hashCode());
        result = prime * result + ((getGroupQrcode() == null) ? 0 : getGroupQrcode().hashCode());
        result = prime * result + ((getAvatar() == null) ? 0 : getAvatar().hashCode());
        result = prime * result + ((getOwnerUid() == null) ? 0 : getOwnerUid().hashCode());
        result = prime * result + ((getGroupNotice() == null) ? 0 : getGroupNotice().hashCode());
        result = prime * result + ((getJoinCount() == null) ? 0 : getJoinCount().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", groupId=").append(groupId);
        sb.append(", groupName=").append(groupName);
        sb.append(", groupQrcode=").append(groupQrcode);
        sb.append(", avatar=").append(avatar);
        sb.append(", ownerUid=").append(ownerUid);
        sb.append(", groupNotice=").append(groupNotice);
        sb.append(", joinCount=").append(joinCount);
        sb.append(", status=").append(status);
        sb.append(", createTime=").append(createTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}